package com.example.ivory.accountbook.Activity;
/*
* 作者：
* 时间：2016.8.27
*
*
*
*
* **/

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;

import com.example.ivory.accountbook.R;

public class ChooseAccount extends AppCompatActivity {
    private String[]data ={"现金","储蓄卡","信用卡","支付宝"};
    private String stringPayWay;
    private Intent intent;
    Button buttonCash;
    Button buttonCredit;
    Button buttonDeposit;
    Button buttonAliPay;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.chooseaccount);
        buttonCash = (Button)findViewById(R.id.button_cash);
        buttonCredit= (Button) findViewById(R.id.btn_creditCard);
        buttonDeposit= (Button) findViewById(R.id.button_depositCard);
        buttonAliPay= (Button) findViewById(R.id.button_alipay);

        //将xml文件包装为view
        LayoutInflater inflater= getLayoutInflater();
        final  View view = inflater.inflate(R.layout.activity_additem,null);

        intent=new Intent();
        //点击按钮，让按钮内容显示在界面上方
        buttonCash.setOnClickListener(new View.OnClickListener() {       //设置按钮单击事件
            public void onClick(View view3) {
                intent.putExtra("payWay","现金");
                intent.setClass(ChooseAccount.this, AddItem.class);
                startActivity(intent);
                Toast.makeText(getApplicationContext(), "现金账户",Toast.LENGTH_SHORT).show();
                ChooseAccount.this.finish();

            }
        });
        buttonDeposit.setOnClickListener(new View.OnClickListener() {       //设置按钮单击事件
            public void onClick(View view3) {
                intent.putExtra("payWay","储蓄卡");
                intent.setClass(ChooseAccount.this, AddItem.class);
                startActivityForResult(intent,1);
                Toast.makeText(getApplicationContext(), "储蓄卡账户",Toast.LENGTH_SHORT).show();
                ChooseAccount.this.finish();

            }
        });
        buttonCredit.setOnClickListener(new View.OnClickListener() {       //设置按钮单击事件
            public void onClick(View view3) {
                intent.putExtra("payWay","信用卡");
                intent.setClass(ChooseAccount.this, AddItem.class);
                startActivity(intent);
                Toast.makeText(getApplicationContext(), "信用卡账户",Toast.LENGTH_SHORT).show();
                ChooseAccount.this.finish();

            }
        });
        buttonAliPay.setOnClickListener(new View.OnClickListener() {       //设置按钮单击事件
            public void onClick(View view3) {
                intent.putExtra("payWay","支付宝");
                intent.setClass(ChooseAccount.this, AddItem.class);
                startActivity(intent);
                Toast.makeText(getApplicationContext(), "支付宝账户",Toast.LENGTH_SHORT).show();
                ChooseAccount.this.finish();

            }
        });



    }

}